/*
 * Copyright
 */
package org.apache.ibatis.transaction;

import java.sql.Connection;
import java.util.Properties;

import javax.sql.DataSource;

import org.apache.ibatis.session.TransactionIsolationLevel;

/**
 * 事务工厂
 *
 * @author ztkool
 * @since 1.0.0
 */
public interface TransactionFactory {

    /**
     * 设置公共参数
     *
     * @param props
     */
    default void setProperties(Properties props) {
        // NOP
    }

    /**
     * 创建事务
     *
     * @param conn
     * @return
     */
    Transaction newTransaction(Connection conn);

    /**
     * 创建事务
     *
     * @param dataSource
     * @param level
     * @param autoCommit
     * @return
     */
    Transaction newTransaction(DataSource dataSource, TransactionIsolationLevel level, boolean autoCommit);

}
